/*

Author   : chaos

FileName : inheritance.cpp

Date     : 13/08/17 23:21:19

*/
#include <iostream>
#include <cstring>
using namespace std;

class library_object
{
    protected:
        char name[30];
        long index;
    public:
        void set_data(const char * i_name)
        {
            strcpy(name,i_name);
            index = 1;
        }
};

class Book : public library_object
{
    private:
        bool on_shelf;
    public:
        void show_data()
        {
            cout << "name : " << name;
            cout << " index : " << index;
            if (on_shelf == true)
                cout << " On shelf " << endl;
            else
                cout << " Not on shelf " << endl;
        }
};

class Reader: public library_object
{
    public:
        void show_data()
        {
            cout << " name : " << name;
            cout << " index : " << index << endl;
        }
};
int main(int argc ,char *argv[])
{

    Reader A_Reader;
    Book A_Book;

    A_Reader.set_data("John");
    A_Reader.show_data();
    A_Book.set_data("The C++ Bible");
    A_Book.show_data();
    return 0;
}
